package com.javandad.app.shared.entity.project;

import java.io.Serializable;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.javandad.app.shared.entity.search.SearchResult;



@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "false")
public class Project implements Serializable, SearchResult {
	
	private static final long serialVersionUID = 2L;
	
	public final static int TYPE_LIBRARY = 1;
	public final static int TYPE_APPLICATION = 2;
	
	@SuppressWarnings("unused")
	private Project() {}
	public Project(String name, int projectType, String desc, String PRL, String RRL)
	{
		this.name = name;
		this.type = projectType;
		this.description = desc;
		this.PRL = PRL;
		this.RRL = RRL;
	}
	
	@Override
	public String toString() {
		return getName();
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getProjectType() {
		return type;
	}
	public void setProjectType(int type) {
		this.type = type;
	}			
	
	public String getPRL() {
		return PRL;
	}
	public void setPRL(String pRL) {
		PRL = pRL;
	}
	public String getRRL() {
		return RRL;
	}
	public void setRRL(String rRL) {
		RRL = rRL;
	}
	public String getEncodedKey() {
		return encodedKey;
	}

	
	public String getProjectFodoURL() {
		return projectFodoURL;
	}
	public void setProjectFodoURL(String projectFodoURL) {
		this.projectFodoURL = projectFodoURL;
	}


	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String encodedKey;
	
	@Persistent
	@Extension(vendorName="datanucleus", key="gae.pk-name", value="true")
	private String name;
	
	@Persistent
	private String description;
	@Persistent
	private int type = Project.TYPE_LIBRARY;
	@Persistent
	private String PRL;
	@Persistent
	private String RRL;
	
	private String projectFodoURL = "/img/icons/project_default_pic.png";

	@Override
	public Type getSearchResultType() {
		return SearchResult.Type.Project;
	}
	
}

